//
//  MXMineTopicListTableViewCell.m
//  MXの衣柜
//
//  Created by 马霄 on 15/8/26.
//  Copyright (c) 2015年 霄 马. All rights reserved.
//

#import "MXMineTopicListTableViewCell.h"
#import "UIImageView+WebCache.h"
@interface MXMineTopicListTableViewCell ()
@property (nonatomic, retain) UILabel *priceLabel;
@end

@implementation MXMineTopicListTableViewCell
- (void)dealloc
{
    [_deleteButton release];
    [_priceLabel release];
    [_mainImageView release];
    [_detailLabel release];
    [super dealloc];
}
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.mainImageView = [[[UIImageView alloc] init] autorelease];
        self.mainImageView.backgroundColor = [UIColor clearColor];
        self.mainImageView.layer.cornerRadius = 30;
        self.mainImageView.layer.masksToBounds = YES;
        [self.contentView addSubview:self.mainImageView];
        
        self.detailLabel = [[[UILabel alloc] init] autorelease];
        self.detailLabel.backgroundColor = [UIColor clearColor];
        self.detailLabel.numberOfLines = 2;
        self.detailLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:self.detailLabel];
        
        self.priceLabel = [[[UILabel alloc] init] autorelease];
        self.priceLabel.backgroundColor = [UIColor grayColor];
        [self.mainImageView addSubview:self.priceLabel];
        
        self.deleteButton = [[[UIImageView alloc] init] autorelease];
        self.deleteButton.backgroundColor = [UIColor redColor];
        self.deleteButton.hidden = YES ; 
        
        [self.mainImageView addSubview:self.deleteButton];
        
        
    }
    return self;
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    CGFloat WID = self.frame.size.width;
    self.mainImageView.frame = CGRectMake(0, 0, WID, WID);
    
    self.detailLabel.frame = CGRectMake(0, WID, WID, HEIGHTPRO * 40);
    
    self.deleteButton.frame = CGRectMake(WID - WIDTHPRO * 20, 0, WIDTHPRO * 20, HEIGHTPRO * 20);
    
}

- (void)getInfo:(MXFindDBModel *)model edit:(BOOL) edit row:(NSInteger)row
{
    [self.mainImageView sd_setImageWithURL:[NSURL URLWithString:model.imagePath] placeholderImage:[UIImage imageNamed:@"plaseholder"]];
    
    self.detailLabel.text = model.detail;
    
    self.deleteButton.hidden = edit;
    
    
    
}




@end
